<%@ page import="java.util.Date" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>已参与的众筹项目</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <%@include file="../include/commonFile.jsp" %>
</head>
<body>
<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <form class="layui-form" action="${ctx}/activity/zcActivity/zcActivityCopartnerList.do" id="myForm" method="post">
                <input type="hidden" name="pageNo" id="pageNo" value="${page.page}"/>
                <div class="f-search-bar">
                    <div class="search-container">
                        <ul class="search-form-content">
                            <li class="form-item-inline"><label class="search-form-lable">项目名称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="title" autocomplete="off" class="layui-input"
                                           value="${activity.title}" placeholder="请输入众筹项目名称">
                                </div>
                            </li>
                            <li class="form-item-inline"><label class="search-form-lable">项目状态</label>
                                <div class="layui-input-inline">
                                    <select name="timeStatus">
                                        <option value="">全部</option>
                                        <option value="0" ${input.timeStatus == 0 ? 'selected' : ''}>进行中</option>
                                        <option value="1" ${input.timeStatus == 1 ? 'selected' : ''}>已截止</option>
                                    </select>
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <div class="sub-btns">
                                    <a class="layui-btn layui-btn-danger"
                                       href="javascript:submitFunction('#myForm')">查询</a>
                                    <a class="layui-btn layui-btn-normal"
                                       href="javascript:resetFunction('#myForm')">重置</a>
                                </div>
                            </li>
                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item"><label class="search-form-lable">参与时间</label>
                                <div class="check-btn-inner" id="timeType">
                                    <a id="all" href="javascript:void(0);"
                                       onclick="setTimeType($(this),0,'#myForm')" ${empty input.timeType || input.timeType == 0 ? 'class="active"' : ''}>全部</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),1,'#myForm')" ${input.timeType == 1 ? 'class="active"' : ''}>今天</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),2,'#myForm')" ${input.timeType == 2 ? 'class="active"' : ''}>本周内</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),3,'#myForm')" ${input.timeType == 3 ? 'class="active"' : ''}>本月内</a>
                                    <input type="hidden" name="timeType" value="${input.timeType}"/>
                                </div>
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createStart"
                                               value="${input.createStart}" placeholder="开始日">
                                    </div>
                                    -
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createEnd"
                                               value="${input.createEnd}" placeholder="截止日">
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
            <div class="c-time-list-content">
                <ul>
                    <c:if test="${page.totalCount == 0}">
                        <div class="f16 tc mt15">还没有已参与的项目</div>
                    </c:if>
                    <c:forEach var="activity" items="${activities}">
                        <li>
                            <div class="detail-content">
                                <a href="${ctx}/activity/zcActivity/zcActivityCopartnerDetail.do?actId=${activity.id}"
                                   target="_self" class="act-logo common-img">
                                    <img src="<c:if test="${ activity.pic!= null}">${activity.pic}?imageMogr2/auto-orient/crop/200x150</c:if>" alt=""
                                         onerror="txz.errImg(this)" onload="txz.imgLoad(this)">
                                </a>
                                <div class="detail">
                                    <div class="act-title">
                                        <c:choose>
                                            <c:when test="${activity.checkStatus == 0}">
                                                <span class="status f20 red">审核中</span>
                                            </c:when>
                                            <c:when test="${activity.checkStatus == 1}">
                                                <c:set var="nowDate" value="<%=new Date()%>"></c:set>
                                                <c:if test="${activity.endTime > nowDate}">
                                                    <span class="status f20 red">进行中</span>
                                                </c:if>
                                                <c:if test="${activity.endTime < nowDate}">
                                                    <span class="status f18 dark">已截止</span>
                                                </c:if>
                                            </c:when>
                                            <c:when test="${activity.checkStatus == 2}">
                                                <span class="status f18 dark">已拒绝</span>
                                            </c:when>
                                        </c:choose>
                                        <a title="${activity.title}"
                                           href="${ctx}/activity/zcActivity/zcActivityCopartnerDetail.do?actId=${activity.id}"
                                           target="_self"
                                           class="title f18 ell db">${activity.title}</a>
                                    </div>
                                    <div>
                                        <p class="act-price">
                                            <span style="margin-right: 10px;">截止时间：
                                                <fmt:formatDate value="${activity.endTime}" pattern="yyyy-MM-dd HH:mm"/>
                                            </span>
                                            <span style="margin-right: 10px;">报名费用：
                                                <b class="active-red">
                                                    <fmt:formatNumber value="${activity.price}" pattern="0.00"/>
                                                </b>元/位
                                            </span>
                                        </p>
                                        <p class="start-time">活动地点：${activity.place}</p>
                                        <p class="act-price">参与时间：
                                            <fmt:formatDate value="${activity.joinTime}" pattern="yyyy-MM-dd HH:mm"/>
                                        </p>
                                        <p class="act-price">
                                            <span style="margin-right: 10px;">
                                                报名人数：<b class="active-red">${activity.joinNum}</b>人
                                            </span>
                                            <span style="margin-right: 10px;">
                                                众筹成功：<b class="active-red">${activity.crowdfundedNum}</b>人
                                            </span>
                                            <span style="margin-right: 10px;">
                                                订单：<b class="active-red">${activity.orderNum}</b>单
                                            </span>
                                            <span style="margin-right: 10px;">累计资金：
                                                <b class="active-red">
                                                    <fmt:formatNumber value="${activity.totalMoney}" pattern="0.00"/>
                                                </b>元
                                            </span>
                                            <span>获得佣金：
                                                <b class="active-red">
                                                    <fmt:formatNumber value="${activity.totalBrokerage}" pattern="0.00"/>
                                                </b>元
                                            </span>
                                        </p>
                                    </div>
                                    <div class="opts-btns tb-opts" style="width:475px;">
                                        <div class="comm-opts">
                                            <a class="qr-btn" href="javascript:txz.openQrDialog({
                                                title:'扫码二维码可预览分享',
                                                detailList:[{
                                                    title:'报名二维码',
                                                    url:'${activity.qrCodeMap.detailQrCode}',
                                                    link:'${activity.qrCodeMap.detailQrCodeContent}'
                                                },{
                                                    title:'联合发起二维码',
                                                    url:'${activity.qrCodeMap.dyQrCode}',
                                                    link:'${activity.qrCodeMap.dyQrCodeContent}'
                                                }]
                                                })"><i class="iconfont icon-qrcode btn-icon"></i> 二维码</a>
                                            <a href="${ctx}/activity/zcActivity/third/editCrowdActivity.do?id=${activity.id}">
                                                <i class="iconfont icon-edit btn-icon"></i>
                                                编辑
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </li>
                    </c:forEach>
                </ul>
            </div>
            <div class="page-content">
                <div id="page_content" class="page-container"></div>
            </div>
        </div>
        <!--底部-->
        <%@include file="../include/footer.jsp" %>
    </section>
</div>

<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript">
    txz.initHeader({
        nav: [{
            name: '已参与的众筹项目',
            curr: true
        }]
    });

    $(function () {
        //加载分页
        loadPageNew({
            elem: 'page_content',
            totalCount: '${page.totalCount}',
            limit: '${page.limit}',
            page: '${page.page}'
        });

        layui.use(['laydate'], function () {
            var laydate = layui.laydate;
            // 查询发布日期
            var createStart = {
                elem: 'input[name=createStart]'
            };

            var createEnd = {
                elem: 'input[name=createEnd]'
            };
            laydate.render(createStart);
            laydate.render(createEnd);
        });
    });
</script>
</body>
</html>